package com.alcloud.springplus.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * @className: Dict
 * @description: 数据字典
 * @author: AllG
 * @createDate: 2018/12/10 13:43
 * @updateRemark: 更新说明
 */
@Data
@Entity
@Table(name="t_dict")
public class Dict implements Serializable {

    private static final long serialVersionUID = 5538226704819624975L;


    /**主键Id*/
    @Id
    @Column(name = "f_dict_id", unique = true, nullable = false)
    @TableGenerator(name = "table_seq", pkColumnValue = "t_dict", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_seq")
    private Long id;

    /**名称*/
    @Column(name = "f_name", nullable = false, length = 128)
    private String name;

    /**字典值*/
    @Column(name = "f_value", nullable = false, length = 128)
    private String value;

    /**字典类型*/
    @Column(name = "f_type", nullable = false, length = 64)
    private String type;

    /**类型描述*/
    @Column(name = "f_type_name", nullable = false, length = 64)
    private String typeName;

    /**排序*/
    @Column(name = "f_seq")
    private Integer seq;

    /**备注*/
    @Column(name = "f_remark", nullable = false, length = 64)
    private String remark;

    /**是否启用*/
    /**0：启用*/
    /**1：停用*/
    @Column(name = "f_status", nullable = false, length = 64)
    private String status;

    /**创建人*/
    @JsonIgnore
    @Column(name = "f_create_by", nullable = false, length = 64)
    private String createBy;

    /**创建时间*/
    @Column(name = "f_create_time", nullable = false, length = 64)
    @CreationTimestamp
    private Timestamp createTime;

    /**更新人*/
    @JsonIgnore
    @Column(name = "f_update_by", nullable = false, length = 64)
    private String updateBy;

    /**更新时间*/
    @Column(name = "f_update_time",  length = 64)
    private Timestamp updateTime;

    /**父对象*/
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_parent_id")
    private Dict parent;

    /**子集合*/
    @Transient
    private List<Dict> children;

}
